import javax.swing.plaf.basic.BasicLookAndFeel;
import java.util.Scanner;
public class Test {

    public static void main(String[] args) {

    }



    public static void main4(String[] args) {
        int a = 0,b = 0,r = 1;
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        if (a < b){
            r = a;
            a = b;
            b = r;
        }
        while (r != 0){
            r = a % b;
            a = b;
            b = r;
        }
        System.out.println(a);
    }


    public static void main3(String[] args) {
        for (int i = 0; i <= 999; i++){
            int tmp = i;
            int sum = 0;
            while(tmp != 0){
                sum += (tmp%10)*(tmp%10)*(tmp%10);
                tmp /= 10;
            }
            if (sum == i) {
                System.out.println(i);
            }
        }
    }



    public static boolean isPrime(int n) {
        boolean flag = true;
        for (int j = 2; j < n; j++){
            if (n % j == 0){
                flag = false;
                break;
            }
        }
        return flag;
    }

    public static void main2(String[] args) {
        int num = 0;
        Scanner sc = new Scanner(System.in);
        num = sc.nextInt();
        if (num >= 56){
            System.out.println("老年");
        } else if (num >= 29) {
            System.out.println("中年");
        } else if (num >= 19) {
            System.out.println("青年");
        } else if (num > 0 && num <= 18){
            System.out.println("少年");
        } else {
            System.out.println("输入错误");
        }

    }
    public static void main1(String[] args) {
        /*for (int i = 1000; i <= 2000; i++) {
            if ( i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
                System.out.println(i);
            }
        }*/
        /*for (int i = 2; i <= 100; i++) {
            boolean flag = true;
            for (int j = 2; j < i; j++){
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println(i);
            }
        }*/
        int n = 0;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        if (isPrime(n)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
